package project.dade.cn.bst.adapter.base;

import android.support.v7.widget.RecyclerView;
import android.widget.ImageView;
import android.widget.RatingBar;

import com.bumptech.glide.Glide;

import cn.bingoogolapple.androidcommon.adapter.BGARecyclerViewAdapter;
import cn.bingoogolapple.androidcommon.adapter.BGAViewHolderHelper;
import project.dade.cn.bst.R;
import project.dade.cn.bst.model.CommentModel;

/**
 * Created by vain zhou on 2016/5/4.
 */
public class CommentAdapter  extends BGARecyclerViewAdapter<CommentModel> {

    public CommentAdapter(RecyclerView recyclerView) {
        super(recyclerView, R.layout.adapter_mycomment);
    }


    @Override
    protected void fillData(BGAViewHolderHelper viewHolderHelper, int postion, CommentModel model) {
        viewHolderHelper.setText(R.id.tv_order_id, "评论订单号: "+model.getOrderNo());
        ImageView avatorIv =viewHolderHelper.getView(R.id.iv_product_image);
        Glide.with(mContext).load(model.getProductImage()).placeholder(R.drawable.image_loader_small).error(R.drawable.image_loader_small).into(avatorIv);
        viewHolderHelper.setText(R.id.tv_tag_comment_point, model.getContent());
        viewHolderHelper.setText(R.id.tv_comment_time,model.getCommentTime());
        RatingBar ratingBar =viewHolderHelper.getView(R.id.point_rating_bar);
        float rating = Float.valueOf(model.getGrade());
        ratingBar.setRating( rating);
    }
}
